function [d] = FunctionForMA(p,tau,L,theta,Counties)

    aux = (p.*L./sum((tau .^ -theta).* (ones(Counties,1) * L).* (ones(Counties,1) * (p .^ (1+ theta)) ) ,2)')';
    tau_aux = tau.^(-theta);

    temp = (tau_aux*aux)'.^(-1/theta);
    d = temp/sqrt(sum(temp.^2));

end
